package org.hikari.qqbot.client.message.segment;

import lombok.*;
import org.hikari.qqbot.client.message.IMessageSegmentAdapter;
import org.hikari.qqbot.client.message.MessageSegment;

import java.util.Map;

/**
 * created at 2024-12-17 01:54:09
 *
 * @author yinchao
 * @version 1.0
 **/
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class AtMessageSegment implements IMessageSegmentAdapter {

    public static final String TYPE = "at";
    private static final String KEY_QQ = "qq";

    private Long qq;

    @Override
    public void fromSegment(MessageSegment segment) {
        this.qq = segment.dataValueToLong(KEY_QQ);
    }

    @Override
    public MessageSegment toSegment() {
        return new MessageSegment(TYPE, Map.of(KEY_QQ, qq));
    }

}
